<?php

/**
 * report actions.
 *
 * @package    Serag
 * @subpackage report
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class reportActions extends sfActions {

    /**
     * Executes index action
     *
     * @param sfRequest $request A request object
     */
    public function executeIndex(sfWebRequest $request) {
        
    }

    public function executeStatement(sfWebRequest $request) {
        $this->form = new StatementForm();

        if ($request->isMethod(sfRequest::POST)) {
            $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));

            if ($this->form->isValid()) {
                $values = $request->getParameter($this->form->getName());
                $customer         = Doctrine::getTable('Customer')->findOneById($values['customer_id']);
                $this->result     = $customer->getStatements($values['fromDate'], $values['toDate'], $values['line_id']);
                $this->oldBalance = $customer->getTheOldBalance($values['fromDate'], $values['line_id']);
//                echo "<pre>";
//                print_r($this->oldBalance);
//                echo "</pre>";
//                exit;
            }
        }
    }

    public function executeDueSheets(sfWebRequest $request) {
        $this->result = TransactionTable::getDueSheet();
//        echo "<pre>";
//        print_r($this->result);
//        echo "</pre>";
 //       exit;
    }

}
